package com.yaolaizaixian.merchant.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yaolaizaixian.merchant.R;

import java.util.List;

/**
 * Created by ylzx on 2017/3/1.
 */
public class PopWindowAdapter extends BaseAdapter {

    private final Context mContext;
    private final List<String> datas;

    public PopWindowAdapter(Context context, List<String> data) {

        this.mContext = context;
        this.datas = data;
    }

    @Override
    public int getCount() {

        return datas.size();
    }

    @Override
    public Object getItem(int position) {

        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        convertView = View.inflate(mContext, R.layout.item_popwindow, null);
        TextView tv_popwindow = (TextView) convertView.findViewById(R.id.tv_popwindow);
        tv_popwindow.setText(datas.get(position));
        return convertView;
    }
}
